<div class="gray_box">
    <div class="inner_menu">
        <div class="top_blue_title float_left"><?php echo __('Suggested Doseyeh') ?></div>
        <div class="dos_show_related">
            Related Topics&nbsp;&nbsp;&nbsp;<span class="dos_blue">>></span>
        </div>
    </div>
    <div class="clear"></div>
    <div class="registration_wrap">
        <div class="dos_show_wrap">
            <div class="dos_show_left" id="dos_id_<?php echo $obj->getId() ?>">
                <table width="100%">

                    <tr>
                        <td class="bl"><?php
$time = strtotime($obj->get('updated_at'));
echo date('F d, Y', $time)
?></td>
                        
                    </tr>
                </table>
                <div class="dos_holder">
                    <!--<div class="preview_overlay"></div>-->
                    <?php //var_dump($obj->getPath($sf_user)); die();?>
                    <?php $path = $obj->getPath($sf_user) ?>
                    <?php if ($path !== false) { ?>
                        <iframe allowtransparency="true" src="<?php echo $path ?>"></iframe>
                    <?php } elseif (preg_match('/http:\/\/www\.youtube\.com\/watch\?v=[^&]+/', $obj->getVideo())) { ?>

                        <iframe title="YouTube video player" class="youtube-player" type="text/html" 
                                width="640" height="390" src="<?php echo $obj->getVideo() ?>"
                                frameborder="0" allowFullScreen></iframe>


                    <?php } else { ?>
                        <center>the requested doseyeh was not found, please try again later</center>
                    <?php } ?>
                </div>
                <div class="clear"></div>
                 <?php if($obj->getFile()): ?>
                <div class="dos_attach">
                    <h4><?php echo __("There is an attachments for this Doseyeh:") ?></h4>
                    <div id="files">
                        <a href="<?php echo public_path("/uploads/doseyeh/file/".$obj->getFile(),true) ?>"><img src="<?php echo image_path("download-button.png",true) ?>" /></a>
                    </div>
                </div>
                <?php endif; ?>

                <div class="social_rating">
                    <div class="doseyeh_inner_social">
                        <div class="fb-like" data-send="false" data-layout="button_count" data-width="80" data-show-faces="false"></div>
                        <a href="https://twitter.com/share" class="twitter-share-button"><?php echo __('Tweet') ?></a>
                    </div>
                    <div class="dos_rating" data-did="<?php echo $obj->getId() ?>" data-rating="<?php echo $obj->getRating() ?>"></div>
                    <div class="dos_view_count">
                        Viewed <?php echo $views_count ?><?php echo __(' times by ') ?><?php echo $viewed_by_users ?> users
                    </div>
                    <div class="clear"></div>
                </div>

                <?php include_component('comments', 'comments', array('model_id' => $obj->getId())) ?>

            </div>
            <div class="dos_show_right">
                <?php include_component('doseyeh', 'related', array('course_id' => $obj->getCourseId(),'culture'=>$sf_user->getCulture())) ?>
            </div>
            <div class="clear"></div>
        </div>
    </div>
</div>

<script>
    $('.dos_rating').raty({
        path: '<?php echo public_path('images/raty/', true) ?>'
        ,size: 22
        ,start: function() {
            return $(this).attr('data-rating');
        }
        ,click: function(rate){
            _rate_elem = this;
            _did = $(this).attr('data-did');
            $.cookie('rated_'+_did, true, '/');
            $.ajax({
                url: "<?php echo url_for('user/rate_dos') ?>?rate="+rate+"&did="+_did,
                context: document.body
            }).done(function(data) { 
                $(_rate_elem).raty('start', data);
                $(_rate_elem).raty('readOnly', true);
            });
        }
    });
<?php if (isset($_COOKIE['rated_' . $obj->getId()])) { ?> 
        $(document).ready(function(){  
            $('#dos_id_'+'<?php echo $obj->getId() ?> .dos_rating').raty('readOnly', true);
        });
<?php } ?>
</script>